package TeacherEvaluation.com.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import TeacherEvaluation.com.dao.loginDao;
import TeacherEvaluation.com.entity.Admin;
import TeacherEvaluation.com.entity.Student;
import TeacherEvaluation.com.entity.Teacher;

/**
 * 登录所用服务层
 * 
 * @author azhao 2019/09/16
 */
@Service
public class loginService {
	@Autowired
	private loginDao logindao;

	// 判断管理员
	public boolean getAdminByNameAndPass(String username) {
		int i = logindao.getAdminByNameAndPass(username);
		if (i > 0) {
			return true;
		}
		return false;
	}
	//保存管理员个人信息
	public Admin getAdminInfo(String username,String password) {
		//System.out.println(username);
		return logindao.getAdminInfo(username,password);
	}

	// 判断老师
	public boolean getTeacherByNameAndPass(String username) {
		int i = logindao.getTeacherByNameAndPass(username);
		if (i > 0) {
			return true;
		}
		return false;
	}
	//保存老师个人信息
	public Teacher getTeacherInfo(String username,String password) {
		return logindao.getTeacherInfo(username,password);
	}

	// 判断学生
	public boolean getStudentByNameAndPass(String username) {
		int i = logindao.getStudentByNameAndPass(username);
		if (i > 0) {
			return true;
		}
		return false;
	}
	//保存学生个人信息
	public Student getStudentInfo(String username,String password) {
		return logindao.getStudentInfo(username,password);
	}
	

}
